<?php
namespace App\Component;
use EasyDingTalk\Application;
use EasySwoole\Component\Singleton;
use EasySwoole\EasySwoole\Config as ESConfig;


class Dingtalk
{

    use Singleton;

    private $corp_id;
    private $app_key;
    private $app_secret;
    public  $client;

    public function __construct($config=[])
    {
        $conf = ESConfig::getInstance()->getConf('DING');

        $config = [
            'corp_id'    => $conf['corpid'],
            'app_key'    => $conf['appkey'],
            'app_secret' => $conf['appsecret'],
        ];

        $this->client = new Application($config);

        return $this->client;
    }

}